package base.adpter.Perproties;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;

/**
 * @program: DesignPatterns
 * @description: 适配器
 * @author: Mr.Dai
 * @create: 2018-04-10 18:46
 **/
public class FileProperties extends Properties implements FileIO {

    @Override
    public void readFromFile(String filename) throws IOException {
            super.load(new FileInputStream(filename));
    }

    @Override
    public void writeToFile(String filename) throws IOException {
        super.store(new FileOutputStream(filename),"写出的配置文件");
    }

    @Override
    public void setValue(String key, String value) {
            super.setProperty(key,value);
    }

    @Override
    public String getValue(String key) {
        return getProperty(key, "");
    }
}
